-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log input event details to verbose log #2371
Conversation
PS: Thanks a lot for developing and maintainig scrcpy. 💘 |
Thank you for your contribution. I think that the log should not be in the "convert" method (wihch is a kind of util method), but in the caller. Input events can be very verbose, they should be enabled in verbose mode only ( For consistency, verbose logs could also be added for other input events (keyboard, touches). (This could be done separately later though.) |
👍 I will try to make changes later today. |
b65886d
to
728f658
Compare
Fixed your notes and added logging for finger events. Didn't implement keyboard event logging yet. |
After reading your For example, by adding a function |
Makes sense to me. Do you think I should log For example, if I want to script an Can you imagine any use cases, where logging intermediate events would be useful? |
I would prefer to log all events sent to the device without distinction. If you want only some of them, it's easy to grep :) |
83e824f
to
3fd36c8
Compare
@rom1v I pushed a partial draft, if you happen to be around, it would be nice to hear if I'm going in the right direction with this. I also noticed only now (embarrassing!) that scrcpy does not currently support a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a partial draft, if you happen to be around, it would be nice to hear if I'm going in the right direction with this.
Yes, looks good 👍 Thank you.
I added few remarks inline.
I also noticed only now (embarrassing!) that scrcpy does not currently support a
SC_LOG_LEVEL_VERBOSE
log level
Oops.
I suppose I need to add support for that as well?
Yes please, as a separate commit :)
3fd36c8
to
2359ffd
Compare
Thanks! My C has been getting a bit rusty. Pushed an updated version.
I was trying to avoid building the Java part. Took me a while to realize that I need to downgrade, seems like it doesn't work with JDK 16 (got some weird error "module java.base does not "opens java.io" to unnamed module"). |
2359ffd
to
3d4cb1b
Compare
app/src/control_msg.c
Outdated
break; | ||
case CONTROL_MSG_TYPE_INJECT_TOUCH_EVENT: { | ||
size_t action = msg->inject_touch_event.action & AMOTION_EVENT_ACTION_MASK; | ||
LOGV("Input: touch %-4s position=%" PRIi32 "x%" PRIi32 " pressure=%g buttons=%06lx", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I omitted pointer_id
from this message because it didn't didn't seem very useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should log it, it allows to distinguish several simultaneous fingers on touch events.
3d4cb1b
to
85200bd
Compare
PR #2371 <#2371> Signed-off-by: Romain Vimont <[email protected]>
PR #2371 <#2371> Signed-off-by: Romain Vimont <[email protected]>
Hi, I allowed myself to work on this based on your branch. I did the following changes:
Here is a branch: I discovered, thanks to the logs, that motion events were sent even if left-click was not pressed (but for example right-click or 4th button), so I fixed it: 0fd5622 👍 I plan to do few more things before merging:
|
PR #2371 <#2371> Signed-off-by: Romain Vimont <[email protected]>
PR #2371 <#2371> Signed-off-by: Romain Vimont <[email protected]>
It was safe to call strcpy() since the input length was checked, but then it is more straightforward to call memcpy() directly.
Mouse motion events were forwarded as soon as any mouse button was pressed. Instead, only consider left-click (and also middle-click and right-click if --forward-all-clicks is enabled).
PR Genymobile#2371 <Genymobile#2371> Signed-off-by: Romain Vimont <[email protected]>
PR #2371 <#2371> Signed-off-by: Romain Vimont <[email protected]>
Done. I updated the |
Thanks, cool to hear that there are other use cases/benefits of this work :) |
How do we proceed? Should I pull your changes to my branch? I'll do that for now. |
85200bd
to
3671e55
Compare
Not necessarily, just tell me if it's ok or if some thkngs should be changed :) I'll merge manually. |
Other than that minor comment, this looks good to me.
OK, I already pushed it, I'm sure you can sort it out :) |
PR Genymobile#2371 <Genymobile#2371> Signed-off-by: Romain Vimont <[email protected]>
On Windows, PRIu64 is defined to "llu", which is not supported: error: unknown conversion type character 'l' in format
This will allow to avoid unnecessary processing for creating logs which will be discarded anyway.
If the log level is not verbose, there is no need to attept to log control messages at all.
OK, it's indeed better that you pushed it, it's more convenient for discussions 😉 |
3671e55
to
0de534d
Compare
Pushed again. Seems fine to me now 👍 |
Thanks 👍 Then let's merge into |
I wanted to automate a few actions using 'adb shell input' commands, but
it requires pixel coordinates. Logging input event details from scrcpy is
helpful for achieving that.